package lq3533;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		boolean[][] a = new boolean[n+1][n+1];
		
		for(int k=0;k<m;k++) {
			int x1 = sc.nextInt();
			int y1 = sc.nextInt();
			int x2 = sc.nextInt();
			int y2 = sc.nextInt();
			
			for(int i=x1;i<=x2;i++){
		        for(int j=y1;j<=y2;j++){
		            a[i][j] = !a[i][j];
		        }
			}
		}
		
		for(int i=1;i<=n;i++){
	        for(int j=1;j<=n;j++){
	        	if(a[i][j])
	        		System.out.print(1);
	        	else 
	        		System.out.print(0);
	        }
	        System.out.println();
	    }
	}

}
